package conMgr.model;

import java.util.Date;
import java.util.Observable;

import conMgr.util.ObservableList;

public class Conference extends Observable
{
	/**
	 * The name of conference.
	 */
	private String name;
	
	/**
	 * The program chair.
	 */
	private User programChair;
	
	/**
	 * Paper submit deadline.
	 */
	private Date submissionDL;
	
	/**
	 * Review submit deadline.
	 */
	private Date reviewDL;
	
	/**
	 * Recommendation submit deadline.
	 */
	private Date recommendationDL;
	
	/**
	 * Paper revision deadline.
	 */
	private Date revisionDL;
	
	/**
	 * A list of the subprogram chairs.
	 */
	private ObservableList<User> subprogramChairs = new ObservableList<User>();
	
	/**
	 * A list of the reviewers.
	 */
	private ObservableList<User> reviewers = new ObservableList<User>();
	
	/**
	 * A list of the papers.
	 */
	private ObservableList<Paper> listOfPapers = new ObservableList<Paper>();
	
	/**
	 * A list of all conferences.
	 */
	private static ObservableList<Conference> listOfAllConferences = new ObservableList<Conference>();
	
	/**
	 * Constructor for the conference object.
	 * @param name is name of the conference
	 * @param programChair 
	 * @param submissionDL is submission deadline
	 * @param reviewDL is review deadline
	 * @param recommendationDL is recommendation deadline
	 * @param revisionDL is revision deadline
	 */
	public Conference(String name, User programChair, Date submissionDL,
					Date reviewDL, Date recommendationDL, Date revisionDL)
	{
		this.name = name;
		this.programChair = programChair;
		this.submissionDL = submissionDL;
		this.reviewDL = reviewDL;
		this.recommendationDL = recommendationDL;
		this.revisionDL = revisionDL;
		
		listOfAllConferences.add(this);
		programChair.getProgramChairConferences().add(this);
	}
	
	/**
	 * Returns a conference's name.
	 * @return name 
	 */
	public String getName()
	{
		return this.name;
	}
	
	/**
	 * Sets the conference's name
	 * @param conferenceName
	 */
	public void setName(String newConferenceName)
	{
		name = newConferenceName;
		setChanged();
		notifyObservers();
	}
	
	/**
	 * Returns a conference's program chair.
	 * @return programChair
	 */
	public User getProgramChair()
	{
		return this.programChair;
	}
	
	/**
	 * Sets a conference's program chair.
	 */
	public void setProgramChair(User newProgramChair)
	{
		programChair = newProgramChair;
		setChanged();
		notifyObservers();
	}
	
	/**
	 * Returns a conference's submission deadline.
	 * @return submissionDL
	 */
	public Date getSubmissionDL()
	{
		return this.submissionDL;
	}
	
	/**
	 * Sets a conference's submission deadline.
	 */
	public void setSubmissionDL(Date newSubmissionDL)
	{
		submissionDL = newSubmissionDL;
		setChanged();
		notifyObservers();
	}
	
	/**
	 * Returns a conference's review deadline.
	 * @return reviewDL
	 */
	public Date getReviewDL()
	{
		return this.reviewDL;
	}
	
	/**
	 * Sets a conference's review deadline.
	 */
	public void setReviewDL(Date newReviewDL)
	{
		reviewDL = newReviewDL;
		setChanged();
		notifyObservers();
	}
	
	/**
	 * Returns a conference's recommendation deadline.
	 * @return recommendationDL
	 */
	public Date getRecommendationDL()
	{
		return this.recommendationDL;
	}
	
	/**
	 * Sets a conference's recommendation deadline.
	 */
	public void setRecommendationDL(Date newRecommendationDL)
	{
		recommendationDL = newRecommendationDL;
		setChanged();
		notifyObservers();
	}
	
	/**
	 * Returns a conference's revision deadline.
	 * @return revisionDL
	 */
	public Date getRevisionDL()
	{
		return this.revisionDL;
		
	}
	
	/**
	 * Sets a conference's revision deadline.
	 */
	public void setRevisionDL(Date newRevisionDL)
	{
		revisionDL = newRevisionDL;
		setChanged();
		notifyObservers();
	}
	
	/**
	 * Returns a list of subprogram chairs.
	 * @return subprogramChairs.
	 */
	public ObservableList<User> getSubprogramChairs()
	{
		return subprogramChairs;
	}
	
	/**
	 * Returns a list of reviewers.
	 * @return reviewers.
	 */
	public ObservableList<User> getReviewers()
	{
		return reviewers;
	}
	
	/**
	 * Returns a list of papers for this conference.
	 * @return listOfPapers.
	 */
	public ObservableList<Paper> getPapers()
	{
		return listOfPapers;
	}
	
	/**
	 * Returns a list of all conferences.
	 * @return listOfAllConferences.
	 */
	public static ObservableList<Conference> getAllConferences()
	{
		return listOfAllConferences;
	}
}
